<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
//引入DB库
use Illuminate\Support\Facades\DB;
class Combo extends Model
{
	protected $table = 'combo';
    //查询方法
    public function test_query($table,$where)
    {
    	$users = DB::table($table)->where($where)->first();
    	$obj_arr=json_decode(json_encode($users),true);
    	return $obj_arr;
    }
    
    /**
    * 添加景区套餐
    */
    public function addCombo($arr)
    {
       return Db::table($this->table)->insert($arr);
    }
    /**
    *  展示景区套餐
    */
    public function showCombo()
    {
       // return Db::table($this->table)->get();
       return DB::table($this->table)
              ->join('admin_scenic', 'combo.scenic_id', '=', 'admin_scenic.scenic_id')
                    ->select('scenic_name','combo_id','combo_name','combo_desc','combo_day','combo_price','combo_starttime','combo_img')
              ->paginate(3);
    }
    /**
     * 景区套餐删除
     */
    public function comboDel($id)
    {
        return DB::table($this->table)->where('combo_id',$id)->delete();
    }
   
}
